<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="<s:url value="/css/common.css"/>" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>

<!-- 当前页面样式 -->
<script type="text/javascript" src="<s:url value="/js/jquery-1.9.1.js" />"></script>
	
<!-- jQuery UI 插件 -->
<script src=<s:url value="/js/ui/jquery.ui.core.js"/>></script>
<script src=<s:url value="/js/ui/jquery.ui.widget.js"/>></script>
<script src=<s:url value="/js/ui/jquery.ui.position.js"/>></script>
<script src=<s:url value="/js/ui/jquery.ui.menu.js"/>></script>
<script src=<s:url value="/js/ui/jquery.ui.autocomplete.js"/>></script>
<link rel="stylesheet" href=<s:url value="/css/demos.css"/>>
	
<style>
		 .fieldError { color: red; text-align: left; }
		.error { float: none; color: red;  vertical-align: top;font-size: 11px;}
		.ui-autocomplete {
		max-height: 200px;
		overflow-y:auto;
		overflow-x: hidden;
	}
	/* IE 6 doesn't support max-height
	 * we use height instead, but this forces the menu to always be this tall
	 */
	* html .ui-autocomplete {
		height: 100px;
	}
</style>

<script type="text/javascript">

   $(document).ready(function(){
   
      loadBrandCode();
   
      $("#sub").click(function(){
         /* var orgCode = $("#orgCode").val();
         if(orgCode == -1){
           alert("请选择机构");
           return false;
         } */
         var posBrand = $("#posBrand").val();
         if(posBrand == -1){
           alert("请选择品牌");
           return false;
         } 
         var posName = $("#posName").val();
         if(posName == -1){
           alert("请选择型号");
           return false;
         } 
         var posType = $("#posType").val();
         if(posType == -1){
           alert("请选择类型");
           return false;
         } 

         var beginSerialNum = $("#beginSerialNum").val();
         if( null == beginSerialNum || "" == beginSerialNum ){
           alert("请选择开始号段");
           return false;
         } 
         
         var endSerialNum = $("#endSerialNum").val();
         if( null == endSerialNum || "" == endSerialNum ){
           alert("请选择结束号段");
           return false;
         } 
         
         if ($("#roleType").val()=='14'){
      		if($("#flag").val()==''){
      			alert("请选择终端等级");
      			return false;
      		}
      	}

         $("#queryUserForm").attr("action","<%=basePath%>/ysbSnBatchLeading/YsbSnBatchLeading.ct");
		 $("#queryUserForm").submit();
      });
   });

		//加载终端名称
	function loadBrandCode() {
	
			var sortCode = $("#posBrand").val();

			if (!sortCode) {
				return;
			}
			
			MccQuery.loadYsbBrandNameByCode(sortCode, function(sortSmall) {
			    clearSelect("posName");
				fillSelect_sort("posName", sortSmall);
			});
		}
		
	function fillSelect_sort(sid, address) {
	  		
				if (!address || !sid) {
					return;
				}
				var $select = $("#" + sid);
				$select.empty();
			    $("#posName").empty().append("<option value='-1'>--请选择--</option>");
				
				
				for ( var i = 0; i < address.length; i++) {
					$select.append("<option value='"+address[i].CODE+"'>"
							+ address[i].NAME + "</option>");
				}
		}
		
	function clearSelect(sid) {
			$("#" + sid).empty().append("<option value='-1'>--请选择--</option>");
		}	
</script>



</head>

<body>
<table class="tb">
    <tbody>
		<s:form id="queryUserForm" action="/ysbSnBatchLeading/YsbSnBatchLeading.ct" method="post"
			theme="simple" enctype="multipart/form-data">
		        <tr class="tb-line">
		            <td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div>
		        </tr>
		<input type="hidden" id ="roleType" name="roleType" value="<s:property value="#request.roleType"/>"/> 
		        <tr class="tb-line">
		            <td class="tb-td" colspan="6"><div class="tb-h3">云商宝SN号段导入</div></td>
		        </tr>
		        <tr class="tb-line">
			    	<td align="right" class="tb-td" >
			    		<div class="tb-h4">账号：</div>
			        </td>
			        <td class="tb-td" >
			            <label class="tb-input-lengthen">
					  		<s:property value="#request.agent.accountNo"/>
					   		<s:hidden name="code" value="%{#request.agent.id}"/>
			            </label>
			        </td>
			    	<td align="right" class="tb-td" >
			    		<div class="tb-h4">姓名：</div>
			        </td>
			        <td class="tb-td" >
			            <label class="tb-input-lengthen">
				  			<s:property value="#request.agent.realName"/>
			            </label>
			        </td>
				 </tr>
				 <tr class="tb-line">
			    	<td align="right" class="tb-td" >
			    		<div class="tb-h4">性别：</div>
			        </td>
			        <td class="tb-td" >
			            <label class="tb-input-lengthen">
				  			<s:property value="#request.agent.sex"/>
			            </label>
			        </td>
			    	<td align="right" class="tb-td" >
			    		<div class="tb-h4">手机号：</div>
			        </td>
			        <td class="tb-td" >
			            <label class="tb-input-lengthen">
				  			<s:property value="#request.agent.mobile"/>
			            </label>
			        </td>
				 </tr>
				 <tr class="tb-line">
			    	<td align="right" class="tb-td" >
			    		<div class="tb-h4">角色类型：</div>
			        </td>
			        <td class="tb-td" >
			            <label class="tb-input-lengthen">
				  			<s:property value="#request.agent.roleType"/>
			            </label>
			        </td>
				   	<td align="right" class="tb-td" >
				    		<div class="tb-h4">所属机构：</div>
				        </td>
				        <td class="tb-td" >
				            <label class="tb-input-lengthen">
								  付临门
				            </label>
				     </td>
				 </tr>
				 <tr class="tb-line">
			    	<td align="right" class="tb-td" >
			    		<div class="tb-h4">上级代理商：</div>
			        </td>
			        <td class="tb-td" >
			            <label class="tb-input-lengthen">
				  			<s:property value="#request.agent.superiorName"/>
			            </label>
			        </td>
			    	<td align="right" class="tb-td" >
			    		<div class="tb-h4">证件号：</div>
			        </td>
			        <td class="tb-td" >
			            <label class="tb-input-lengthen">
				  			<s:property value="#request.agent.cardNo"/>
			            </label>
			        </td>
				 </tr>
				<tr class="tb-line">
					<td align="right" class="tb-td" >
			    		<div class="tb-h4">状态：</div>
			        </td>
			        <td class="tb-td" >
			            <label class="tb-input-lengthen">
				  			<s:property value="#request.agent.status"/>
			            </label>
			        </td>
				<s:if test="#request.roleType==\"14\"">
				  <td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">终端等级：</div>
		            </td>
				    <td class="tb-td">
                	<label class="tb-select">
					<s:select cssClass="queryWidth" name="flag" id="flag"
						list="#{'':'请选择','A':'A','B':'B','C':'C','D':'D'}" />	
					</label>
				   </td>
				   </s:if>
				   </tr>
				   <tr class="tb-line">
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">品牌：</div></td>
					<td class="tb-td">
                		<label class="tb-select">
							<s:select cssClass="queryWidth" name="yjPosBatch.posBrand"
								id="posBrand"
								list="#request.brandMap" listKey="key" listValue="value" onchange="loadBrandCode()" 
								 headerKey="-1" headerValue="--请选择--"/>
						</label>
					</td>
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">型号：</div></td>
					<td class="tb-td">
                		<label class="tb-select">
							<s:select cssClass="queryWidth" name="yjPosBatch.posName"
								id="posName"
								list="#request.nameMap" listKey="key" listValue="value" 
								 headerKey="-1" headerValue="--请选择--"/>
						</label>	
					</td>
				</tr>
				<tr class="tb-line">
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">开始号段SN：</div>
		             </td>
					<td class="tb-td">
                    	<span>
                    		<input id="beginSerialNum" name="yjPosBatch.beginSerialNum"  placeholder="输入开始号段SN" style="width:150px;"/>
                    	</span>	
					</td>
					
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">结束号段SN：</div>
		             </td>
					<td class="tb-td">
                    	<span>
                    		<input id=endSerialNum name="yjPosBatch.endSerialNum"  placeholder="输入结束号段SN" style="width:150px;"/>
                    	</span>	
					</td>
				</tr>
				
				<tr class="tb-line">
				
					<td class="tb-td line-submit" align="center" colspan="4">
                		<label class="tb-input-submit">
							<s:submit id="sub"  value="导入" />
		                </label>
					</td>
				</tr>
				<tr class="tb-line">
						<td colspan="8" align="center"><span style="font-color: red"><s:actionerror /></span>
							<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
				</tr>
				<tr class="tb-line">
					<td colspan="8">&nbsp;<s:token></s:token></td>
				</tr>
		</s:form>
    </tbody>
</table>

	<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
<script type="text/javascript">

    $(function() {
    	autoGetAgentInfoByName();
	});
</script>
</body>
</html>
